Socket
Socket
Sign inDemoInstall

imask

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

imask


Version published
Weekly downloads
608K
decreased by-0.47%
Maintainers
1
Install size
702 kB
Created
Weekly downloads
 

Package description

What is imask?

The 'imask' npm package is a versatile input masking library that allows developers to create input masks for various types of data, such as dates, numbers, and custom patterns. It is highly customizable and supports dynamic masks, pattern masks, and more.

What are imask's main functionalities?

Date Mask

This feature allows you to create a date input mask. The code sample demonstrates how to apply a date mask to an input element with the pattern 'YYYY-MM-DD'.

const element = document.getElementById('date-input');
const maskOptions = { mask: Date, pattern: 'Y-`m-`d' };
const mask = IMask(element, maskOptions);

Number Mask

This feature allows you to create a number input mask. The code sample shows how to apply a number mask to an input element with a range from 0 to 10,000 and a thousands separator.

const element = document.getElementById('number-input');
const maskOptions = { mask: Number, min: 0, max: 10000, thousandsSeparator: ',' };
const mask = IMask(element, maskOptions);

Pattern Mask

This feature allows you to create a custom pattern mask. The code sample demonstrates how to apply a pattern mask to an input element for a credit card number format.

const element = document.getElementById('pattern-input');
const maskOptions = { mask: '0000-0000-0000-0000' };
const mask = IMask(element, maskOptions);

Dynamic Mask

This feature allows you to create dynamic masks that can switch between different patterns based on the input. The code sample shows how to apply a dynamic mask that switches between a phone number and a short code format.

const element = document.getElementById('dynamic-input');
const maskOptions = { mask: [{ mask: '+{7}(000)000-00-00' }, { mask: '0000-0000' }] };
const mask = IMask(element, maskOptions);

Other packages similar to imask

Readme

Source

imaskjs

vanilla javascript input mask

Build Status Coverage Status npm version License: MIT

Docs, Examples, Demo

https://imask.js.org/

Install

npm install imask and import IMask from 'imask';

or use CDN:

<script src="https://unpkg.com/imask"></script>

Build & Test

npm run make

Keywords

FAQs

Last updated on 08 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc